<html>
    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1" /> 
        <title>微信安全支付</title>
    </head>
    <script>
        //设置每隔1000毫秒执行一次load() 方法  
        var myIntval = setInterval(function () {
            load()
        }, 1000);
        function load() {
            var xmlhttp;
            if (window.XMLHttpRequest) {
                // code for IE7+, Firefox, Chrome, Opera, Safari    
                xmlhttp = new XMLHttpRequest();
            } else {
                // code for IE6, IE5    
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    trade_state = xmlhttp.responseText;
                    if (trade_state == '1') {
                        setTimeout(window.location.href='/user/action/qrcode?store_id=<?php echo $_GET['store_id'];?>', 3000);

                    } else if (trade_state == 'REFUND') {
                        document.getElementById("myDiv").innerHTML = '转入退款';
                        clearInterval(myIntval);
                    } else if (trade_state == 'NOTPAY') {
                        document.getElementById("myDiv").innerHTML = '请扫码支付';

                    } else if (trade_state == 'CLOSED') {
                        document.getElementById("myDiv").innerHTML = '已关闭';
                        clearInterval(myIntval);
                    } else if (trade_state == 'REVOKED') {
                        document.getElementById("myDiv").innerHTML = '已撤销';
                        clearInterval(myIntval);
                    } else if (trade_state == 'USERPAYING') {
                        document.getElementById("myDiv").innerHTML = '用户支付中';
                    } else if (trade_state == 'PAYERROR') {
                        document.getElementById("myDiv").innerHTML = '支付失败';
                        clearInterval(myIntval);
                    }

                }
            }
            //orderquery.php 文件返回订单状态，通过订单状态确定支付状态  
            xmlhttp.open("POST", "/pay/notify/query", false);
            //下面这句话必须有    
            //把标签/值对添加到要发送的头文件。    
            xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            xmlhttp.send("order_number=<?php echo $order_number;?>");

        }
    </script>
    <body>
        <div style='background-color:#32CD32;text-align: center;padding-top: 8rem;height:100%'>
        <div style="margin-left: 10px;color:white;font-size:20px;font-weight: bolder;">对不起，Android系统暂时仅支持二维码支付</div><br/>
        <div style="margin-left: 10px;color:#556B2F;font-size:20px;font-weight: bolder;">双击二维码，待图片变大，长按二维码支付</div><br/>
        <img alt="模式二扫码支付" src="/user/action/createqrcodeWeixin?store_id=<?php echo $_GET['store_id'];?>&url=<?php echo urlencode($url2);?>" style="width:150px;height:150px;"/>
        <div id="myDiv"></div>
        </div>
    </body>
</html>